package oo;

import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;

import entity.ZsmWojewodztwa;

import zsm.zsm_;

public class ComboBoxDemoBean {

	private String drink;
	public String getDrink() {
		System.out.println("getdrink"+drink);
		return drink;
	}
	public void setDrink(String drink) {
		System.out.println("setdrink"+drink);
		this.drink = drink;
	}

	private List<ZsmWojewodztwa> st=new ArrayList<ZsmWojewodztwa>();
	private SelectItem [] states;
	public SelectItem[] getStates() {
		return states;
	}
	public void setStates(SelectItem[] states) {
		this.states = states;
	}
	public ComboBoxDemoBean() {
		initSelectItems();
	}
	
	public void initSelectItems() {
		st=zsm_.pobierz_wojewodztwa();
		Iterator<ZsmWojewodztwa> it=st.iterator();
		SelectItem[] temp=new SelectItem[st.size()];
		int i=0;
		while(it.hasNext()){
			temp[i]=new SelectItem(((ZsmWojewodztwa)it.next()).getNazwa());i++;}
		states=temp;
	}
	
}
